#include<bits/stdc++.h>
using namespace std;
long long n,q,x,b,c;
char f;
long long a[8010],srt[8010];
int main() {
	freopen("sort.in","r",stdin);
    freopen("sort.out","w",stdout);
	scanf("%lld%lld",&n,&q);
	for(int i=1; i<=n; i++) {
		scanf("%lld",&a[i]);
		srt[i]=a[i];
	}
	sort(srt+1,srt+n+1);
	for(int i=1; i<=q; i++) {
		cin>>f;
		if(f=='1') {
			cin>>x>>b;
			for(int j=1; j<=n; j++) {
				if(a[x]==srt[j]) {
					a[x]=b;
					srt[j]=b;
					break;
				}
			}
			sort(srt+1,srt+n+1);
		}
		if(f=='2') {
			long long t;
			cin>>x;
			for(int j=1; j<=n; j++) {
				if(a[x]==srt[j]) {
					t=j;
					break;
				}
			}
			printf("%lld\n",t);
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
